package com.dxy.app.act_widget;

import android.app.Activity;
import android.os.Bundle;
import android.support.annotation.Nullable;
import android.util.Log;
import android.widget.Toast;
import com.dxy.app.R;
import com.dxy.app.widget.shrink_upvote.ShrinkUpvoteView;
import com.dxy.app.widget.shrink_upvote.VoteView;
import com.dxy.app.widget.switch_view.SwitchView;

/**
  *Created by duxingyu on 2017/7/24.18:02
  *Email: 
  *Description:测试控件的界面
  **/

public class TestViewActivity extends Activity {

  public static final String TAG="TAG_TestViewActivity";

  @Override protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_test_view);
    initViews();
  }
  private void initViews(){
    VoteView vv = (VoteView) findViewById(R.id.vv);
    float offsetX = (float) Math.sin(Math.toRadians(30));//
    Log.i(TAG, "initViews: "+offsetX);
    vv.setListener(type->{
      if(type == ShrinkUpvoteView.VoteType.DISLIKE){
        Toast.makeText(this, "不喜欢", Toast.LENGTH_SHORT).show();
      }else if(type == ShrinkUpvoteView.VoteType.JUST){
        Toast.makeText(this, "一般般", Toast.LENGTH_SHORT).show();
      }else{
        Toast.makeText(this, "喜欢", Toast.LENGTH_SHORT).show();
      }
    });

    SwitchView sv = (SwitchView) findViewById(R.id.sv);
    sv.setState(true);
    sv.setCallBack(state->{
      if(state){
        Toast.makeText(this, "选中!!", Toast.LENGTH_SHORT).show();
      }else{
        Toast.makeText(this, "未选中!!", Toast.LENGTH_SHORT).show();
      }
    });
  }
}
